package com.wsx.seven.a;

import java.util.Arrays;

public class Main0004 {

    public static void main(String[] args) {
        int[] array = new int[]{1, 6, 3, 9, 5, 10, 7, 8};
        crSort(array);
        System.out.println(Arrays.toString(array));
    }

    public static void crSort(int[] array) {
        for (int i = 1; i < array.length; i++) {
            int iv = array[i];
            int idx = i - 1;
            while (idx >= 0 && iv < array[idx]) {
                array[idx + 1] = array[idx];
                idx--;
            }
            array[idx + 1] = iv;
        }
    }

    private static void swap(int[] array, int i, int j) {
        int temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }
}
